<?php
namespace app\admin\model;

use think\Model;

class Login extends Model
{
    protected $table = 'user';
    protected $fk = 'id';
    protected $mapFields = [
        // 为混淆字段定义映射
        'username'        =>  'User.u_user',
        'password'        =>  'User.u_pwd',
    ];

    public function cheUsedStatus($data)
    {
        //先查处用户名是否正常，如果正常就匹配用户加密密码
        $b = db('admin')->where("a_user ='" . $data['adminuser'] . "'")->find();
        if ($b['a_psw'] == md5($data['adminpassword'] . $b['a_md5'])) {
            return $b;
        } else {
            return false;
        }

    }
}